/*********************************************************
          File Name:queue.h
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Fri 15 Apr 2016 09:18:43 AM CST
**********************************************************/

#ifndef QUEUE_H_
#define QUEUE_H_

#include <stdbool.h>
#include <stdlib.h>

typedef struct qNode
{
	int job;
	int (*cb)(int);
	struct qNode *front, *rear;
	size_t size;
} qNode;

typedef struct 
{
	qNode* queue;
	
	size_t limit;
	
	int (*push_back)(qNode*, qNode*);
	
	int (*pop_front)(qNode*);
	
	qNode* (*front)(qNode*);
	
	bool (*is_empty)(qNode*);
	
	int (*clear)(qNode*);
} Queue;

Queue* NewQueue(size_t max_size);

void DeleteQueue(Queue* q);

#endif
